package chapter01

import java.text.SimpleDateFormat

/*

运算符
https://www.w3cschool.cn/groovy/groovy_operators.html


* */


class Example {
    static void main(String[] args) {
        //chapter01.Example of a int datatype
        int x = 5;

        //chapter01.Example of a long datatype
        long y = 100L;

        //chapter01.Example of a floating point datatype
        float a = 10.56f;

        //chapter01.Example of a double datatype
        double b = 10.5e40;

        //chapter01.Example of a BigInteger datatype
        BigInteger bi = 30g;

        //chapter01.Example of a BigDecimal datatype
        BigDecimal bd = 3.5g;

        int  age = 10;
        println("age:${age}")
        age ++;
        println("=== age:${age}")
        println(x);
        println(y);
        println(a);
        println(b);
        println(bi);
        println(bd);
    }
}


class Example2 {
    static void main(String[] args) {

        // x is defined as a variable
//        String x = "Hello";
//        println("x : ${x}")

//        // Defining a variable in lowercase
//        int x = 5;
//
//        // Defining a variable in uppercase
//        int X = 6;
//
//        // Defining a variable with the underscore in it's name
//        def _Name = "Joe";

//        println(x);
//        println(X);
//        println(_Name);
//        //Printing the value of the variables to the console
//        println("The value of x is " + x + " The value of X is " + X);
//        println("The value of x is ${x} The value of X is ${X}" )

//        def now = new Date()

//        println("now:${now}")


        // 获取当前时间
        Date now = new Date()

        // 创建 SimpleDateFormat 实例，指定日期格式
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")

        // 使用 format() 方法将 Date 对象格式化为字符串
        String formattedDate = dateFormat.format(now)
        // 打印格式化后的日期
        println(formattedDate)

    }
}